import requests


class TestManage:

    @classmethod
    def add_emp_api(cls, token, add_emp_boby):
        add_emp_url = "http://ihrm2-test.itheima.net/api/sys/user"
        add_emp_header = {"Content-Type": "application/json",
                          "Authorization": token}
        resp = requests.post(url=add_emp_url, headers=add_emp_header, json=add_emp_boby)
        return resp

    @classmethod
    def query_emp_api(cls, emp_id, token):
        query_url = "http://ihrm2-test.itheima.net/api/sys/user/" + emp_id
        query_head = {"Authorization": token}
        resp_query_emp = requests.get(url=query_url, headers=query_head)
        return resp_query_emp

    @classmethod
    def modify_emp_api(cls, emp_id, token, boby):
        query_url = "http://ihrm2-test.itheima.net/api/sys/user/" + emp_id
        query_head = {"Authorization": token}
        resp_query_emp = requests.put(url=query_url, headers=query_head, json=boby)
        return resp_query_emp

    @classmethod
    def delete_emp_api(cls, emp_id, token):
        query_url = "http://ihrm2-test.itheima.net/api/sys/user/" + emp_id
        query_head = {"Authorization": token}
        resp_query_emp = requests.delete(url=query_url, headers=query_head)
        return resp_query_emp
